package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


@Entity
@Table(name = "bjdacp_user_info")
public class UserInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "人员";
	public static final String ALIAS_USER_INFO_ID = "userInfoId";
	public static final String ALIAS_USERNAME = "用户名";
	public static final String ALIAS_PASSWORD = "密码";
	public static final String ALIAS_SEX = "性别";
	public static final String ALIAS_REAL_NAME = "姓名";
	public static final String ALIAS_IS_LOGOUT = "是否注销";

	//date formats


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * userInfoId       db_column: user_info_id
     */
	
	private java.lang.Integer userInfoId;
    /**
     * 用户名       db_column: username
     */
	@Length(max=100)
	private java.lang.String username;
    /**
     * 密码       db_column: password
     */
	@Length(max=100)
	private java.lang.String password;
    /**
     * 性别       db_column: sex
     */
	
	private java.lang.Integer sex;
    /**
     * 姓名       db_column: real_name
     */
	@Length(max=100)
	private java.lang.String realName;
    /**
     * 是否注销       db_column: is_logout
     */
	
	private java.lang.Integer isLogout;
	//columns END


	public UserInfo(){
	}

	public UserInfo(
		java.lang.Integer userInfoId
	){
		this.userInfoId = userInfoId;
	}



	public void setUserInfoId(java.lang.Integer value) {
		this.userInfoId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "user_info_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getUserInfoId() {
		return this.userInfoId;
	}

	@Column(name = "username", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getUsername() {
		return this.username;
	}

	public void setUsername(java.lang.String value) {
		this.username = value;
	}

	@Column(name = "password", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getPassword() {
		return this.password;
	}

	public void setPassword(java.lang.String value) {
		this.password = value;
	}

	@Column(name = "sex", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getSex() {
		return this.sex;
	}

	public void setSex(java.lang.Integer value) {
		this.sex = value;
	}

	@Column(name = "real_name", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getRealName() {
		return this.realName;
	}

	public void setRealName(java.lang.String value) {
		this.realName = value;
	}

	@Column(name = "is_logout", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getIsLogout() {
		return this.isLogout;
	}

	public void setIsLogout(java.lang.Integer value) {
		this.isLogout = value;
	}


	private Set drugSellUnitModifyLogs = new HashSet(0);
	public void setDrugSellUnitModifyLogs(Set<DrugSellUnitModifyLog> drugSellUnitModifyLog){
		this.drugSellUnitModifyLogs = drugSellUnitModifyLog;
	}

	@OneToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "userInfo")
	public Set<DrugSellUnitModifyLog> getDrugSellUnitModifyLogs() {
		return drugSellUnitModifyLogs;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("UserInfoId",getUserInfoId())
			.append("Username",getUsername())
			.append("Password",getPassword())
			.append("Sex",getSex())
			.append("RealName",getRealName())
			.append("IsLogout",getIsLogout())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getUserInfoId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof UserInfo == false) return false;
		if(this == obj) return true;
		UserInfo other = (UserInfo)obj;
		return new EqualsBuilder()
			.append(getUserInfoId(),other.getUserInfoId())
			.isEquals();
	}
}

